{extend name="base" /}
{block name="body"}

<div class="layui-col-sm12 layui-col-md12 layui-col-lg12" style="background: white;">
    <center>
        <blockquote class="layui-elem-quote">添加后台管理员</blockquote>
            <form action="{:request()->url()}" class="layui-form" method="post" style="padding-top:6%;padding-bottom: 6%">

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">账号</label>
                        <div class="layui-input-inline">
                            <input lay-verify="required|username" type="text" name="username"
                                   value="{$data.username|default=''}" autocomplete="off"
                                   placeholder="请输入账号" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-inline">
                            <input type="password" name="password"
                                   value="" autocomplete="off"
                                   placeholder="请输入密码" class="layui-input">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">真实姓名</label>
                        <div class="layui-input-inline">
                            <input lay-verify="required|real_name" type="text" name="real_name"
                                   value="{$data.real_name|default=''}" autocomplete="off"
                                   placeholder="请输入真实姓名" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                    <label class="layui-form-label">所属角色</label>
                    <div class="layui-input-inline">
                        <select lay-verify="required|role_id" name="role_id" lay-filter="lay-select" lay-search>
                            <option value="0" selected>--请选择角色--</option>
                            {foreach name="roleData" item="vo"}
                            <option value="{$vo.id}" {if condition="isset($data) and $data.role_id eq $vo.id" } selected {/if} >{$vo.name}</option>
                            {/foreach}
                        </select>
                    </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-inline">
                        <div class="layui-upload">
                            <button type="button" class="layui-btn ajax-img-icon">上传图片</button>
                            <div class="layui-upload-list layui-input-inline">
                                <input type="hidden" id="img_url" name="icon" value="{$data.icon|default=''}"/>
                                <img class="layui-upload-img" style="width: 100px;height: 100px;" name="icon"
                                     src="{$data.icon|default='__ADMIN_IMG__user_icon/head_default.gif'}" id="my-icon">
                                <p id="demoText"></p>
                            </div>
                        </div>
                    </div>
                    </div>
                </div>

                <div class="layui-form-item" pane>
                    <div class="layui-inline">
                    <label class="layui-form-label">启用？</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="是" {if
                               condition="isset($data) and $data.status eq 1" }checked{/if} checked>
                        <input type="radio" name="status" value="0" title="否" {if
                               condition="isset($data) and $data.status eq 0" }checked{/if} >
                    </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-filter="add" lay-submit="">保存</button>
                        <a class="layui-btn layui-btn-primary" href="javascript:history.go(-1);">返回</a>
                    </div>
                </div>
            </form>
    </center>
</div>
{/block}
{block name="js"}
